Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and improve docker setup. #215

Merged
merged 4 commits into from
Feb 24, 2025
Merged

Conversation

myronmarston
Copy link
Collaborator

@myronmarston myronmarston commented Feb 22, 2025

Allow CLI ElasticGraph gem source to be overriden via ENV var.

We'll use this from our Dockerfile to ensure our local gems get used.


Move docker files to config/docker_demo.

These files aren't "primary" enough to put at the repository root.

With these changes, the docker command is now:

$ docker compose -f config/docker_demo/docker-compose.yaml up --build elasticgraph

Simplify and improve docker setup.

  • Don't bundle install or pull in the Ruby base image multiple times.
  • Instead of copying over the entire project, just copy over the parts that we need.
    This should make building the elasticgraph docker image faster.
  • Provide a strong guarantee that no released ElasticGraph gems are being used, as
    we only want our local ElasticGraph gems to get built into the docker image.
  • Use ELASTICGRAPH_GEMS_PATH env var instead of a sed command. The sed
    command is a bit harder to maintain, IMO, and could be brittle--the replaced
    code snippet may change in the future.
  • Remove OpenSearch Dashboards. While they are often useful to include, we want
    to keep our demo setup as slimmed down as possible, and minimize the likelihood
    that users will run out of docker resources.
  • Honor the OPENSEARCH_VERSION ENV var rather than hardcoding it to 2.18.0.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@myronmarston myronmarston force-pushed the myron/improve-onestep-docker branch from 94b99fa to 9c15084 Compare February 22, 2025 07:59
We'll use this from our Dockerfile to ensure our local gems get used.
These files aren't "primary" enough to put at the repository root.

With these changes, the docker command is now:

```
$ docker compose -f config/docker_demo/docker-compose.yaml up --build elasticgraph
```
- Don't `bundle install` or pull in the Ruby base image multiple times.
- Instead of copying over the entire project, just copy over the parts that we need.
  This should make building the `elasticgraph` docker image faster.
- Provide a strong guarantee that no released ElasticGraph gems are being used, as
  we only want our local ElasticGraph gems to get built into the docker image.
- Use `ELASTICGRAPH_GEMS_PATH` env var instead of a `sed` command. The `sed`
  command is a bit harder to maintain, IMO, and could be brittle--the replaced
  code snippet may change in the future.
- Remove OpenSearch Dashboards. While they are often useful to include, we want
  to keep our demo setup as slimmed down as possible, and minimize the likelihood
  that users will run out of docker resources.
- Honor the `OPENSEARCH_VERSION` ENV var rather than hardcoding it to 2.18.0.
@myronmarston myronmarston force-pushed the myron/improve-onestep-docker branch from 9c15084 to 94acf14 Compare February 22, 2025 08:06
@myronmarston myronmarston marked this pull request as ready for review February 22, 2025 08:31
Copy link
Collaborator

@jwils jwils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the nested directory makes sense as it's a docker file that launches the test app not a dockerfile for the library as I was initially thinking when I started. I think ideally bundle install can run before copying over the rest of the files, and I think a blacklist makes more sense than a whitelist of directories but this is a good improvement from what I had.

As @jwils pointed out, it's beneficial to run the `bundle install` as early
as possible, because we want expensive steps that change less frequently
(e.g. gem downloads) to run earlier.
Base automatically changed from joshuaw/onestep/opensearch to main February 24, 2025 02:16
@myronmarston myronmarston merged commit ac83c3b into main Feb 24, 2025
14 of 15 checks passed
@myronmarston myronmarston deleted the myron/improve-onestep-docker branch February 24, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants